let storage = {

  local: {
    get: (key, defaultValue) => {
      let v = localStorage.getItem(key)

      if (null == v) {
        v = defaultValue;
      }

      return v
    },

    set: (key, value) => {
      localStorage.setItem(key, value)
    },

    rm: (key) => {
      localStorage.removeItem(key)
    },

    clean: () => {
      localStorage.clear();
    }

  },

  session: {
    get: (key, defaultValue) => {
      let v = sessionStorage.getItem(key)

      if (null == v) {
        v = defaultValue;
      }

      return v
    },

    set: (key, value) => {
      sessionStorage.setItem(key, value)
    },

    rm: (key) => {
      sessionStorage.removeItem(key)
    },

    clean: () => {
      sessionStorage.clear();
    }

  },

}

export default storage;
